package data_structure;

public class leetcode_0559 {
    public int maxDepth(Node root) {
        if(root==null) return 0;
        return deep(root);
    }
    public int deep(Node node){
        if(node.children==null) return 1;
        else{
            int len=node.children.size();
            int deep=0;
            for(int i=0;i<len;++i){
                int tem=deep(node.children.get(i));
                deep=(deep>tem)?deep:tem;
            }
            return deep+1;
        }
    }
}
